/* 
 * File:   error_dialog.cpp
 * Author: jolo
 * 
 * Created on 5. Oktober 2011, 23:11
 */

#include "error_dialog.hpp"

#include <QtGui/QVBoxLayout>

#include "log_widget.hpp"
#include "label.hpp"

namespace widgets
{
    error_dialog::error_dialog(QWidget* p, const QString& title)
    : dialog(p)
    {
        setWindowTitle(title);
        setLayout(new QVBoxLayout(this));

        lbl_w_ = new label(this);
        lbl_w_->setText(title);
        
        log_w_ = new log_widget(this);
        
        box_layout()->addWidget(lbl_w_);
        box_layout()->addWidget(log_w_);
    }

    error_dialog::~error_dialog()
    {
    }
    
    QBoxLayout* error_dialog::box_layout() {
        return dynamic_cast<QBoxLayout*>(layout());
    }
    
    void error_dialog::set_message(const string& msg) {
        log_w_->setText(msg.c_str());
    }

}